package com.itheima.controller;

import com.itheima.common.Result;
import com.itheima.util.OssBootUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/sys")
public class FileUploadController {

    @PostMapping("/upload")
    public Result<String> upload(MultipartFile file) throws Exception {
        String uploadPath = OssBootUtil.upload(file, "upload");
        return Result.ok(uploadPath);
    }
}
